<template>
  <view class='mymessage'>
	  <view>
		  <u-collapse>
		  		<u-collapse-item :title="item.head+item.time+'   '+item.isResult" v-for="(item, index) in itemList" :key="index">
		  			{{item.body}}
		  		</u-collapse-item>
		  	</u-collapse>
	  </view>
  </view>
</template>

<script>
export default {
  props: {},
  data() {
    return {
		itemList:[],
		text: true ,
		myMessage:[]
	};
  },
  filters:{
	  timeStamp: function(value) {
	  	if (!value) return '';
	  	var now = new Date(value);
	  	// console.log("time:" + JSON.stringify(now));
	  	// var year = now.getFullYear();
	  	var month = now.getMonth() + 1;
	  	if (month < 10) {
	  		month = '0' + month
	  	}
	  	var date = now.getDate();
	  	if (date < 10) {
	  		date = '0' + date
	  	}
	  	return  month + "-" + date
	  }
  },
  computed: {},
  onLoad() {
	  this.mymessage()
  },
  methods: {
	  onshow(index,msg){
		  if(msg != ''){
		  	var pattern = new RegExp("[\u4E00-\u9FA5]+");
		  	var pattern2 = new RegExp("[A-Za-z]+");
		  	var pattern3 = new RegExp("[0-9]+");
		  	if(pattern.test(msg) && msg.length > '15'){
		  		this.myMessage[index].isSelected=true
		  	}else if(pattern2.test(msg) && msg.length > 30){
		  		this.myMessage[index].isSelected=true
		  	}else if(pattern3.test(msg) && msg.length > 30){
		  		this.myMessage[index].isSelected=true
		  	}else{
		  		this.myMessage[index].isSelected=false
		  	}
		  }
	  },
	  async mymessage(){
		  var _this=this
		 var value=uni.getStorageSync('myinfo')
		 let studentId=value.user.studentId
		 let url='http://taruinfo.work:8088/feedback/getFeedbackByLists?current=1&size=100&studentId='+studentId
		 uni.request({
		 	url:url,
			method:'get',
			success:function(res){
				if(res.data.code==200){
					console.log(res.data)
					var aa=[]
					for(var i=0;i<res.data.data.records.length;i++){
						
						if(res.data.data.records[i].feedbackResult==0){
							var data={
								time:res.data.data.records[i].feedbackTime,
								head:res.data.data.records[i].type,
								body:res.data.data.records[i].content,
								isResult:'未处理',
								open:false
							}
						}else{
							var data={
								time:res.data.data.records[i].feedbackTime,
								head:res.data.data.records[i].type,
								body:res.data.data.records[i].content,
								isResult:'已处理',
								open:false
							}
						}
						aa[i]=data
					}
					_this.itemList=aa
				}
			}
		 })
	  },
	  clickshouqi1(index){
		  this.myMessage[index].isSelected=false
	  }
  },
};
</script>

<style scoped lang="less" >
	.mymessage{
		width: 690rpx;
		margin: 0 30rpx;
		.my_message{
			margin-top: 44rpx;
			display: flex;
			.my_image{
				image{
					width: 78rpx;
					height: 78rpx;
				}
			}
			.my_right{
				margin-left: 32rpx;
				position: relative;
				padding-bottom: 40rpx;
				border-bottom: 1rpx solid #e6e6e6;
				.text{
					display: flex;
					justify-content: space-between;
					width: 580rpx;
					.text_left{
						color: #262626;
						font-size: 32rpx;
					}
					.text_right{
						color: #b3b3b3;
						font-size: 24rpx;
					}
				}
				.text1{
					color: #808080;
					font-size: 26rpx;
					width: 580rpx;
				}
				.shouqi{
					position: absolute;
					bottom: 22rpx;
					right: 0;
					font-size: 24rpx;
					color: #b3b3b3;
					image{
						width: 20rpx;
						height: 20rpx;
						margin-left: 7rpx;
					}
				}
			}
		}
	}
	
	.bottom{
		margin-top: 25rpx;
		color: #B3B3B3;
		font-size: 26rpx;
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
	}
	.cen_con{
		width: 400rpx !important ;
		overflow:hidden;
		text-overflow:ellipsis;
		white-space:nowrap;
	}
</style>

